package pojo;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "Privilege")
public class Privilege implements Serializable{
	private static final long serialVersionUID = -3135274373623388745L;

	@Id
    @Column(name = "level")
    private int level;

	@Column(name = "name")
	private String name;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "privilege")
	private Set<UserAccount> users = new HashSet<UserAccount>();
	
	public Privilege() {}	
	
	public Privilege(int level, String name) {
		this.level = level;
		this.name = name;
	}
	
	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<UserAccount> getUsers() {
		return users;
	}

	public void setUsers(Set<UserAccount> users) {
		this.users = users;
	}
	
	public String toString(){
	      return name;
	}
}
